<div id="content-wrapper" class="corner">
<h1>Accounts List <a href="<?php echo url_for('accounts/new') ?>">| New</a></h1>
<?php foreach ($accounts as $account): ?>
<span class="list-item">
    <span class="item-id">
    	<a href="<?php echo url_for('accounts/show?id_account='.$account->getIdAccount()) ?>"><?php echo $account->getIdAccount() ?></a>
    </span>
   
    <span class="titulo-item">
		<a href="<?php echo url_for('accounts/show?id_account='.$account->getIdAccount()) ?>">
			<?php echo $account->getAccountName() ?>
        </a>
    </span>
     &nbsp;&nbsp;&nbsp;&nbsp;
     <span class="titulo-item">
    	 Contact: <span class="item-result"><?php echo $account->getRefContact() ?>
   </span></span>
     &nbsp;
     <span class="titulo-item">
     		phone: <span class="item-result"><?php echo $account->getBillingPhone() ?>
     </span></span>
      &nbsp;
     <span class="titulo-item">
     		Billing contact: <span class="item-result"><?php echo $account->getBillingContact() ?></span>
     </span>
</span>

<span class="space">
</span>


<table class="hidden" style="display:none;">
  <thead>
    <tr>
      <th>Id account</th>
      <th>Account name</th>
      <th>Ref contact</th>
      <th>Billing phone</th>
      <th>Billing email</th>
      <th>Billing contact</th>
      <th>Company name</th>
    </tr>
  </thead>
  <tbody>
    
    <tr>
      <td><a href="<?php echo url_for('accounts/show?id_account='.$account->getIdAccount()) ?>"><?php echo $account->getIdAccount() ?></a></td>
      <td><?php echo $account->getAccountName() ?></td>
      <td><?php echo $account->getRefContact() ?></td>
      <td><?php echo $account->getBillingPhone() ?></td>
      <td><?php echo $account->getBillingEmail() ?></td>
      <td><?php echo $account->getBillingContact() ?></td>
      <td><?php echo $account->getCompanyName() ?></td>
    </tr>
    <?php endforeach; ?>
  </tbody>
</table>

<div class="pagination">
<?php if ($pager->haveToPaginate()): ?>
  <span><?php echo 'Showing from '.$pager->getFirstIndice().' to '.$pager->getLastIndice().' of '.$pager->count().' accounts'; ?></span><br/>
  <?php if (!$pager->isFirstPage()) :  ?>
  <a href="<?php echo url_for('accounts/index') ?>"><?php echo 'First' ?></a>

  <a href="<?php echo url_for('accounts/index') ?>?page=<?php echo $pager->getPreviousPage() ?>"><?php echo 'Previous' ?></a>
  <?php endif; ?>

  <?php foreach ($pager->getLinks() as $page): ?>
    <?php if ($page == $pager->getPage()): ?>
      <?php echo $page ?>
    <?php else: ?>
      <a href="<?php echo url_for('accounts/index') ?>?page=<?php echo $page ?>"><?php echo $page ?></a>
    <?php endif; ?>
  <?php endforeach; ?>

  <?php if (!$pager->isLastPage()) :  ?>
  <a href="<?php echo url_for('accounts/index') ?>?page=<?php echo $pager->getNextPage() ?>"> <?php echo 'Next' ?></a>

  <a href="<?php echo url_for('accounts/index') ?>?page=<?php echo $pager->getLastPage() ?>"><?php echo 'Last' ?></a>
  <?php endif; ?>

<?php endif; ?>
</div>
</div>  
